<template>
  <div>
    <router-view> </router-view>
    <tarBar v-if="state.show"></tarBar>
  </div>
</template>

<script setup>
import tarBar from "@/components/tabBar.vue";
import { reactive } from "vue";
import { useRouter } from "vue-router";

const router = useRouter();
const state = reactive({
  menu: ['/home', '/data', '/setting'],
  show: false,
});
//是否显示底部导航栏，取决于当前路由是否在菜单中
router.beforeEach((to, from, next) => {
   state.show = state.menu.includes(to.path);
  next();
})
</script>

<style lang="less" scoped>

</style>